{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nohup: ignoring input and appending output to 'nohup.out'\r\n"
     ]
    }
   ],
   "source": [
    "!mv nohup.out nohup.out95\n",
    "!nohup scrapy crawl dianyingtt "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 276,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Traceback (most recent call last):\r\n",
      "  File \"/usr/local/bin/scrapy\", line 10, in <module>\r\n",
      "    sys.exit(execute())\r\n",
      "  File \"/usr/local/lib/python3.7/site-packages/scrapy/cmdline.py\", line 110, in execute\r\n",
      "    settings = get_project_settings()\r\n",
      "  File \"/usr/local/lib/python3.7/site-packages/scrapy/utils/project.py\", line 68, in get_project_settings\r\n",
      "    settings.setmodule(settings_module_path, priority='project')\r\n",
      "  File \"/usr/local/lib/python3.7/site-packages/scrapy/settings/__init__.py\", line 288, in setmodule\r\n",
      "    module = import_module(module)\r\n",
      "  File \"/usr/local/lib/python3.7/importlib/__init__.py\", line 127, in import_module\r\n",
      "    return _bootstrap._gcd_import(name[level:], package, level)\r\n",
      "  File \"<frozen importlib._bootstrap>\", line 1006, in _gcd_import\r\n",
      "  File \"<frozen importlib._bootstrap>\", line 983, in _find_and_load\r\n",
      "  File \"<frozen importlib._bootstrap>\", line 967, in _find_and_load_unlocked\r\n",
      "  File \"<frozen importlib._bootstrap>\", line 677, in _load_unlocked\r\n",
      "  File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\r\n",
      "  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\r\n",
      "  File \"/root/jupyternotebook/dytt8project-master/dytt8project/settings.py\", line 27, in <module>\r\n",
      "    MYSQL_HOST=localhost\r\n",
      "NameError: name 'localhost' is not defined\r\n"
     ]
    }
   ],
   "source": [
    "!tail -50 nohup.out"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 列表页\n",
    "\n",
    "scrapy shell http://www.ygdy8.net/html/gndy/dyzz/list_23_2.html\n",
    "\n",
    "### 详情页\n",
    "\n",
    "scrapy shell http://www.ygdy8.net/html/gndy/dyzz/20190316/58329.html\n",
    "\n",
    "view(response)"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "for link in response.xpath('//a[@class=\"ulink\"]/@href'):    \n",
    "    print ('http://www.ygdy8.net'+link.extract())\n",
    "\n",
    "\n",
    "next_page = response.xpath('//div[@class=\"x\"]//a[last()-1]')\n",
    "next_page_url = 'http://www.ygdy8.net/html/gndy/dyzz/'+next_page.xpath('//@href').extract()\n",
    "print (next_page_url)\n",
    "\n",
    "next_page = response.xpath('//div[@class=\"x\"]//a[last()-1]/@href').extract()\n",
    "next_page_url = 'http://www.ygdy8.net/html/gndy/dyzz/'+next_page[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "scrapy shell http://www.ygdy8.net/html/gndy/dyzz/20190326/58363.html\n",
    "\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[1]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[2]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[3]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[4]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[5]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[6]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[7]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[8]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[9]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[10]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[11]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[12]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[13]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[14]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[15]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[16]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[17]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[18]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[19]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[20]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[21]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[22]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[23]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[24]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[25]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[26]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[27]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[28]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[29]').extract()) )\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[30]').extract()) )\n",
    "\n",
    "print (  ''.join(response.xpath('//div[@id=\"Zoom\"]//td/table/tbody/tr/td/a/text()').extract()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re\n",
    "def re_patten(patten,text):\n",
    "    try:\n",
    "        re.match()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 结果测试"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "scrolled": true
   },
   "source": [
    "! head -5 test.csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pymongo\n",
    "\n",
    "from pymongo import MongoClient\n",
    "client = MongoClient()\n",
    "client = MongoClient('localhost', 27017)"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "db = client['scrapy_dytt01']\n",
    "\n",
    "print (db.list_collection_names())\n",
    "import pprint\n",
    "pprint.pprint(db.dytt8_crawler.find_one())\n",
    "print ()\n",
    "pprint.pprint(db.dytt8_crawler.estimated_document_count())\n",
    "print ()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['test02', 'test03', 'test01']\n",
      "4804\n",
      "\n"
     ]
    }
   ],
   "source": [
    "db = client['scrapy_dytt']\n",
    "\n",
    "print (db.list_collection_names())\n",
    "import pprint\n",
    "#pprint.pprint(db.test01.find_one())\n",
    "#print ()\n",
    "pprint.pprint(db.test03.estimated_document_count())\n",
    "print ()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " 'word': '',\r\n",
      " 'year': ''}\r\n",
      "2019-04-21 11:24:37 [scrapy.core.scraper] DEBUG: Scraped from <200 http://www.ygdy8.net/html/gndy/dyzz/20100902/27934.html>\r\n",
      "{'category': '',\r\n",
      " 'country': '',\r\n",
      " 'director': '',\r\n",
      " 'douban': '',\r\n",
      " 'fileformat': '',\r\n",
      " 'filesize': '',\r\n",
      " 'imdb': '',\r\n",
      " 'issuedata': '',\r\n",
      " 'language': '',\r\n",
      " 'movielens': '',\r\n",
      " 'oname': '',\r\n",
      " 'scriptwriter': '',\r\n",
      " 'tname': '',\r\n",
      " 'url': 'ftp://dygod1:dygod1@d058.dygod.org:2038/拳皇.[中英双字.1024分辨率]/[电影天堂www.dy2018.com]拳皇BD中英双字.rmvb',\r\n",
      " 'word': '',\r\n",
      " 'year': ''}\r\n",
      "2019-04-21 11:24:37 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://www.ygdy8.net/html/gndy/dyzz/20100904/27970.html> (referer: http://www.ygdy8.net/html/gndy/dyzz/list_23_159.html)\r\n"
     ]
    }
   ],
   "source": [
    "!tail -20 nohup.out"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "!pip3 install openpyxl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [],
   "source": [
    "!rm -f test03.xlsx"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 273,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ok\n"
     ]
    }
   ],
   "source": [
    "import pymongo\n",
    "import re\n",
    "\n",
    "client = pymongo.MongoClient('localhost', 27017)\n",
    "db = client['scrapy_dytt']\n",
    "\n",
    "filter1 = {}\n",
    "\n",
    "filter2 = {\n",
    "            'weburl':1,\n",
    "            'tname':1,\n",
    "            'oname':1,\n",
    "            'year':1,\n",
    "            'country':1,\n",
    "            'category':1,\n",
    "            'language':1,\n",
    "            'word':1,\n",
    "            'issuedata':1,\n",
    "            'imdb':1,\n",
    "            'douban':1,\n",
    "            'movielens':1,\n",
    "            'director':1,\n",
    "            'ftpurl':1\n",
    "          }\n",
    "\n",
    "\n",
    "results = db.test06.find(filter1,filter2)\n",
    "\n",
    "from openpyxl import Workbook\n",
    "wb = Workbook()\n",
    "\n",
    "# grab the active worksheet\n",
    "ws = wb.active\n",
    "\n",
    "ws.append((\n",
    "            'weburl',\n",
    "            'tname',\n",
    "            'oname',\n",
    "            'year',\n",
    "            'country',\n",
    "            'category',\n",
    "            'language',\n",
    "            'word',\n",
    "            'issuedata',\n",
    "            'imdb',\n",
    "            'douban',\n",
    "            'movielens',\n",
    "            'director',\n",
    "            'ftpurl'))\n",
    "\n",
    "for data in results:\n",
    "    weburl = data['weburl']\n",
    "    tname = data['tname']\n",
    "    oname = data['oname']\n",
    "    year = data['year']\n",
    "    country = data['country']\n",
    "    category = data['category']\n",
    "    language = data['language']\n",
    "    word = data['word']\n",
    "    issuedata = data['issuedata']\n",
    "    imdb = data['imdb']\n",
    "    douban = data['douban']\n",
    "    movielens = data['movielens']\n",
    "    director = data['director']\n",
    "    ftpurl = data['ftpurl']\n",
    "    \n",
    "    result = (\n",
    "            weburl,\n",
    "            tname,\n",
    "            oname,\n",
    "            year,\n",
    "            country,\n",
    "            category,\n",
    "            language,\n",
    "            word,\n",
    "            issuedata,\n",
    "            imdb,\n",
    "            douban,\n",
    "            movielens,\n",
    "            director,\n",
    "            ftpurl)\n",
    "    ws.append(result)\n",
    "\n",
    "wb.save(\"test06.xlsx\")\n",
    "print ('ok')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "text = '''<div id=\"Zoom\">\n",
    "<!--Content Start--><span style=\"FONT-SIZE: 12px\"><td>\n",
    "<p><br /><img style=\"WIDTH: 591px; HEIGHT: 871px\" onclick=\"if(this.width&gt;screen.width-461) window.open('http://fujian.yyets.com/month_1204/12041521236874a27c3695d4a5.jpg');\" border=\"0\" alt=\"\" width=\"574\" height=\"1092\" src=\"http://fujian.yyets.com/month_1204/12041521236874a27c3695d4a5.jpg\" /><br /><br /><span style=\"COLOR: black\">◎译　　名　大侦探福尔摩斯2：诡影游戏/神探福尔摩斯：诡影游戏(港)/福尔摩斯：诡影游戏(台)<br />◎片　　名　Sherlock Holmes A Game of Shadows<br />◎年　　代　2011<br />◎国　　家　美国<br />◎类　　别　动作/冒险/犯罪/神秘/惊悚<br />◎语　　言　英语<br />◎字　　幕　中英双字幕<br />◎IMDB评分 7.6/10 from 79.743 users<br />◎文件格式　BD-RMVB<br />◎视频尺寸　1280 x 720<br />◎文件大小　1CD<br />◎片　　长　129 Mins<br />◎导　　演　盖&middot;里奇 Guy Ritchie<br />◎主　　演　小罗伯特&middot;唐尼 Robert Downey Jr.&nbsp; ....Sherlock Holmes<br />　　　　　　裘德&middot;洛 Jude Law&nbsp; ....Dr. John Watson<br />　　　　　　劳米&middot;拉佩斯 Noomi Rapace&nbsp; ....Madam Simza Heron<br />　　　　　　瑞秋&middot;麦克亚当斯 Rachel McAdams&nbsp; ....Irene Adler<br />　　　　　　杰瑞德&middot;哈里斯 Jared Harris&nbsp; ....Professor James Moriarty<br />　　　　　　斯蒂芬&middot;弗雷 Stephen Fry&nbsp; ....Mycroft Holmes<br />　　　　　　保罗&middot;安德森 Paul Anderson&nbsp; ....Colonel Sebastian Moran<br />　　　　　　凯利&middot;蕾莉 Kelly Reilly&nbsp; ....Mary Watson<br />　　　　　　杰拉丁尼&middot;詹姆斯 Geraldine James&nbsp; ....Mrs. Hudson<br />　　　　　　埃迪&middot;马森 Eddie Marsan&nbsp; ....Inspector Lestrade<br />　　　　　　William Houston&nbsp; ....Constable Clark<br />　　　　　　Wolf Kahler&nbsp; ....Doctor Hoffmanstahl<br />　　　　　　Iain Mitchell&nbsp; ....Auctioneer<br />　　　　　　Jack Laskey&nbsp; ....Carruthers<br />　　　　　　Patricia Slater&nbsp; ....Shush Club Maitre D'<br />　　　　　　卡丽玛&middot;阿德贝 Karima Adebibe&nbsp; ....Shush Club Maitre D'<br />　　　　　　Richard Cunningham&nbsp; ....Businessman<br />　　　　　　Marcus Shakesheff&nbsp; ....Hashisheen<br />　　　　　　Mark Sheals&nbsp; ....Cock Fight Referee<br />　　　　　　George Taylor&nbsp; ....University Student<br />　　　　　　Michael Webber&nbsp; ....Vicar<br />　　　　　　Mike Grady&nbsp; ....Train Conductor<br />　　　　　　亚利山德烈&middot;卡里尔 Alexandre Carril&nbsp; ....Twin<br />　　　　　　维克多&middot;卡里尔 Victor Carril&nbsp; ....Twin<br />　　　　　　Thorston Manderlay&nbsp; ....Alfred Meinhard<br />　　　　　　Affif Ben Badra&nbsp; ....Tamas<br />　　　　　　Daniel Naprous&nbsp; ....Marko<br />　　　　　　Lancelot Weaver&nbsp; ....Stefan<br />　　　　　　Vladimir 'Furdo' Furdik&nbsp; ....Andrzej (as Vladimir Furdik)<br />　　　　　　Jacques Senet Larson&nbsp; ....Gypsy Kid<br />　　　　　　Nicolas Senet Larson&nbsp; ....Gypsy Kid<br />　　　　　　Sebastian Senet Larson&nbsp; ....Gypsy Kid<br />　　　　　　Alexander Devrient&nbsp; ....Gypsy<br />　　　　　　Fatima Adoum&nbsp; ....Gypsy<br />　　　　　　Stanley Kaye&nbsp; ....Stanley<br />　　　　　　蒂埃里&middot;钮维 Thierry Neuvic&nbsp; ....Claude Ravache<br />　　　　　　Martin Nelson&nbsp; ....Commendatore<br />　　　　　　Mark Llewelyn-Evans&nbsp; ....Don Giovanni<br />　　　　　　Anthony Inglis&nbsp; ....Conductor<br />　　　　　　Ian Wilson-Pope&nbsp; ....Leporello<br />　　　　　　Pamela Hay&nbsp; ....Elvira<br />　　　　　　Laurence Dobiesz&nbsp; ....Servant<br />　　　　　　Peter Stark&nbsp; ....German Officer<br />　　　　　　Roman Jankovic&nbsp; ....German Officer<br />　　　　　　Frederick Ruth&nbsp; ....Ballroom Attendant<br />　　　　　　Carsten Hayes&nbsp; ....Ballroom Photographer<br />　　　　　　Jonathan Christie&nbsp; ....Dilplomat<br />　　　　　　James McNeil&nbsp; ....Diplomat<br />　　　　　　Laurence Possa&nbsp; ....Rene Heron (as Laurentiu Possa)<br />　　　　　　Maitland Chandler&nbsp; ....Banker<br />　　　　　　Joe Egan&nbsp; ....Big Joe<br />　　　　　　克里夫&middot;罗素 Clive Russell&nbsp; ....Captain Tanner<br /><br />◎简　　介'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 210,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3555\n"
     ]
    }
   ],
   "source": [
    "print (len(text))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<re.Match object; span=(0, 116), match='>◎中 文 名\\u3000三枪拍案惊奇<br />◎英 文 名\\u3000  A Simple N>\n",
      "matchobj3.group(1) :    A Simple Noodle Story/The First Gun/San Qiang Pai An Jing Qi/Amazing Tales: Three Guns\n"
     ]
    }
   ],
   "source": [
    "text = '           mal\">◎IMDb评分 5.7/10 from 100 users</span><br style=\"WIDOWS: 2; TEXT-TRANSFORM: none; FONT-STYLE: norma <td style=\"WORD-WRAP: break-word\" bgcolor=\"#fdfddf\"><a href=\"ftp://ygdy8:ygdy8@yg45.dydytt.net:8046/[阳光电影www.ygdy8.com].神奇女侠.BD.720p.国英双语.中英双字幕.mkv\">ftp://ygdy8:ygdy8@yg45.dydytt.net:8046/[阳光电影www.ygdy8.com].神奇女侠.BD.720p.国英双语.中英双字幕.mkv</a></td>'\n",
    "text2 = 'asdsad◎译　　名　11sssss影游戏/神探影游戏(台)<br />◎片　　名　宿舍Sherlock<br />2012◎年　　代 3000a<>◎年　　代 0020a<>'\n",
    "text3 = '>◎中 文 名　三枪拍案惊奇<br />◎英 文 名　  A Simple Noodle Story/The First Gun/San Qiang Pai An Jing Qi/Amazing Tales: Three Guns<br'\n",
    "matchobj3 = re.match('.*?\\u25ce\\u82f1[\\u3000|\\u0020]\\u6587[\\u3000|\\u0020]\\u540d[\\u3000|\\u0020]([\\u4e00-\\u9fa5_a-zA-Z0-9 ].*?)<.*?', text3, re.M|re.I)\n",
    "\n",
    "print (matchobj3)\n",
    "if matchobj3:\n",
    "    print (\"matchobj3.group(1) : \", matchobj3.group(1))\n",
    "    #print (\"matchobj3.group(1) : \", matchobj3.group(2))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 269,
   "metadata": {},
   "outputs": [],
   "source": [
    "matchobj2 = re.match('.*?\\u25ce\\u0049\\u004d\\u0044\\u0042\\u8bc4\\u5206\\u0020(.*?)<br />.*?', text, re.M|re.I)\n",
    " \n",
    "if matchobj2:\n",
    "    print (\"matchObj.group() : \", matchobj2.group())\n",
    "    print (\"matchObj.group(1) : \", matchobj2.group(1))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "        item['weburl'] = response.url\n",
    "        item['tname'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[3]').extract())   #译名\n",
    "        item['oname'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[4]').extract())   #片名\n",
    "        item['year'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[5]').extract())   #年代\n",
    "        item['country'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[6]').extract())   #产地\n",
    "        item['category'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[7]').extract())   #类别\n",
    "        item['language'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[8]').extract())   #语言        \n",
    "        item['word'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[9]').extract())   #字幕\n",
    "        item['issuedata'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[10]').extract())   #上映日期\n",
    "        item['imdb'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[11]').extract())   #IMDb评分\n",
    "        item['douban'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[12]').extract())   #豆瓣评分\n",
    "        item['fileformat'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[13]').extract())   #文件格式\n",
    "        item['filesize'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[14]').extract())   #文件大小\n",
    "        item['movielens'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[15]').extract())   #片长\n",
    "        item['director'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[16]').extract())   #导演\n",
    "        item['scriptwriter'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/p[1]/text()[17]').extract())   #编剧        \n",
    "        item['ftpurl'] = ''.join(response.xpath('//div[@id=\"Zoom\"]//td/table/tbody/tr/td/a/text()').extract())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
